home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_4
/
smallmath
/
smallmath.doc
< prev
next >
Wrap
Text File
|
1993-01-24
|
4KB
|
75 lines
Small Math Libraries
v. 1.2
Public domain software by Laz Marhenke
I. Legal stuff:
These libraries are public domain. Do as you will with them (except, of
course, copyright them).
II. The Software:
The enclosed libraries (mathieeesingtrans.library,
mathieeedoubbas.library, and mathieeedoubtrans.library) are replacements
for the IEEE math libraries that come with the Amiga for users who have a
math coprocessor (68881, 68882, or 68040) installed in their system. They
should be "plug-compatible"; i.e., just copy them into your LIBS: drawer
and go. Unlike the originals, however, these libraries will *not* work if
you don't have a math coprocessor -- they will, in fact, certainly crash
your machine. The advantage to using these libraries over the
Commodore-supplied ones is that these are 60-90% smaller. The space savings
was realized by not including any code in the libraries for use when a
coprocessor is not available. Note that these libraries are no faster than
the Commodore libraries (which already make use of a coprocessor when one
is available), just smaller (but see below).
To install the libraries, execute the included script "Install_Libs"
(using "execute" from a shell window or by double-clicking on the icon from
the Workbench). The script will copy the small math libraries into your
LIBS: drawer, overwriting the old versions. For this reason, make sure you
are working with a copy of your Workbench disk. Alternately, you can just
copy them manually by whatever method you like.
III. Bugs (Features?):
This version (1.2) is intended to correct a rather embarrassing bug that
got through in the version 1.1a Cmp() function in the
mathieeedoubbas.library. The effect of the bug was that the compare gave
the wrong result for two unequal negative arguments. Thanks to
Rainer Koehler for finding the bug and sending me an annotated bit of C
code which nicely patched the hole in my own testing. I also squeezed a few
microseconds out of the Tst() function, and cleaned up the source a little.
The other two libraries (the transcendental libraries) are essentially
identical to those distributed as version 1.1a, but have been relinked
using the SAS 6.0 release, which makes them a few bytes smaller.
Keep in mind that to actually begin using the libraries you may have to
reboot your system after installing them, since other programs (AREXX in
particular) may have already opened some of them, and the computer won't
reload the library from disk if it's already in memory.
The only other thing to be concerned about is a possible incompatibility
in the Pow() function. The Pow() function in the Commodore-supplied
transcendental libraries did not behave well (to my mind) when given
unusual input. By "unusual", I mean things like negative numbers to
infinite powers, or positive infinity to the zero power, etc. The most
common response of the routine was to return zero -- in many of these cases
the wrong answer. However, in at least one case (I think it was raising a
negative number to the negative infinity power, but I no longer remember),
the Commodore-supplied routine simply crashed. I decided that this was
unacceptable, and so did not reproduce this behavior in my libraries. The
Pow() function I wrote tries its best to return a reasonable number given
unreasonable inputs (a positive number to the negative infinity power
should be zero, for example). When no reasonable answer is possible (e.g.,
-4^0.5), it returns NaN (not-a-number). Somehow, in doing this, I managed
to write a Pow() routine which is about twice as fast as the one in the
original libraries. Naturally this made me suspicious that I had missed
something, but I've tested the function with every combination of inputs
that I can come up with and it works fine.
I have taken the liberty of making these libraries versions 37.2, and
37.3, since as far as I can tell, they contain all the functions that the
v.37 libraries do.
With any other bugs or problems, you can contact me via e-mail at
laz@leland.stanford.edu . (My physical address varies slightly more rapidly
than my e-mail address.)